package com.example.gpio_app;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });


        List<Map<String, Object>> productData = GetDate();
        GpioViewAdapter gpioViewer = new GpioViewAdapter(MainActivity.this,productData);
        GridView gridView = findViewById(R.id.grid);
        gridView.setAdapter(gpioViewer);
    }

    private List<Map<String, Object>> GetDate() {
        List<Map<String, Object>> productData = new ArrayList<>();
        Map<String, Object> output = new HashMap<>();
        output.put("name", "OutPut");
        output.put("isShow", "true");
        productData.add(output);

        Map<String, Object> input = new HashMap<>();
        input.put("name", "InPut");
        input.put("isShow", "false");
        productData.add(input);

        return productData;
    }


}